<#macro pageTree type='static' filepath=''>
	<@_templateList path=filepath type=type>
		<@_metadata dir=filepath type=type><#local metaDataMap=object/></@_metadata>
		<#list list as a>
			<@t.merge 'pages' filepath+'/'+a.fileName/>
		</#list>
		<@_sysDeptPage deptId=admin.deptId!'' type=type pages=t.pages!><#assign deptPageMap=map!/></@_sysDeptPage>
		<#list list as a>
			<#local path=filepath+'/'+a.fileName>
			<#if 'ftl'!=a.fileName&&'include'!=a.fileName&&(deptPageMap[path])?has_content&&deptPageMap[path]>
				<li>
				<#if a.directory>
					<a href="javascript:;" onclick="return false;">
						${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}
					</a>
					<ul>
						<@pageTree type path/>
					</ul>
				<#else>
					<a href="cmsPage/${('dynamic'=type)?then('dynamicPlaceList','staticPlacelist')}.html?path=${path?url}&type=${type}" target="navTab" title="${('static'=type)?then('静态','动态')}页面:${a.fileName}" rel="cmsPage">
						${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}
					</a>
				</#if>
				</li>
			</#if>
		<#else>
			<li><a>空目录</a></li>
		</#list>
	</@_templateList>
</#macro>
<#macro contentCategoryTree parentId=''>
	<@_categoryList parentId=parentId>
		<#list page.list as a>
			<@t.merge 'categoryIds' a.id!/>
		</#list>
		<@_sysDeptCategory deptId=admin.deptId!'' categoryIds=t.categoryIds!><#assign deptCategoryMap=map!/></@_sysDeptCategory>
		<#list page.list as a>
			<#if (deptCategoryMap[a.id?string])?has_content&&deptCategoryMap[a.id?string]>
				<li>
					<a href="cmsContent/list.html?categoryId=${a.id}" target="navTab" rel="cmsContent/list" title="内容:${a.name!}">${a.name!}</a>
				<#if a.childIds?has_content>
					<ul>
						<@contentCategoryTree a.id/>
					</ul>
				</#if>
				</li>
			</#if>
		<#else>
			<li><a>空目录</a></li>
		</#list>
	</@_categoryList>
</#macro>
<#macro categoryTree parentId=''>
	<@_categoryList parentId=parentId>
		<#list page.list as a>
			<li>
				<a href="cmsCategory/list.html?categoryId=${a.id}" target="navTab" rel="cmsCategory/list" title="分类:${a.name!}">${a.name!}</a>
			<#if a.childIds?has_content>
				<ul>
					<@categoryTree a.id/>
				</ul>
			</#if>
			</li>
		<#else>
			<li><a>空目录</a></li>
		</#list>
	</@_categoryList>
</#macro>
<div class="accordion">
<@_sysMoudleList parentId=parentId>
	<#list page.list as a>
		<@t.merge 'moudleIds' a.id!/>
	</#list>
	<@_sysRoleMoudle roleIds=admin.roles moudleIds=t.moudleIds!><#assign roleMoudleMap=map!/></@_sysRoleMoudle>
	
	<#list page.list as a>
		<#if (roleMoudleMap[a.id?string])??&&roleMoudleMap[a.id?string]>
	<div class="accordionHeader">
		<h2><span>Folder</span>${a.name?html}</h2>
	</div>
	<div class="accordionContent">
		<ul class="tree treeFolder">
	<#switch a.url>
		<#case 'cmsContent/list'>
			<li>
				<@_sysDept id=admin.deptId>
					<#assign  dept=object/>
				</@_sysDept>
				<#if dept?has_content&&dept.ownsAllCategory>
					<a href="cmsContent/list.html" target="navTab" rel="cmsContent/list">内容分类</a>
				<#else>
					<a href="javascript:;" onclick="return false;">内容分类</a>
				</#if>
				<ul>
					<@contentCategoryTree/>
				</ul>
			</li>
			<#break>
		<#case 'cmsCategory/list'>
			<li>
				<a href="cmsCategory/list.html" target="navTab" rel="cmsCategory/list">分类</a>
				<ul>
					<@categoryTree/>
				</ul>
			</li>
			<#break>
		<#case 'cmsPage/staticPlaceList'>
			<@pageTree/>
			<#break>
		<#case 'cmdPage/dynamicPlaceList'>
			<@pageTree 'dynamic'/>
			<#break>
		<#default>
			<@_sysMoudleList parentId=a.id>
				<#list page.list as a>
					<@t.merge 'childMoudleIds' a.id!/>
				</#list>
				<@_sysRoleMoudle roleIds=admin.roles moudleIds=t.childMoudleIds!><#assign childRoleMoudleMap=map!/></@_sysRoleMoudle>
				<#list page.list as a>
					<#if (childRoleMoudleMap[a.id?string])?has_content&&childRoleMoudleMap[a.id?string]>
			<li><a href="${a.url?html}" target="navTab" rel="${a.url?html}">${a.name?html}</a></li>
					</#if>
				</#list>
			</@_sysMoudleList>
	</#switch>
		</ul>
	</div>
		</#if>
	</#list>
</@_sysMoudleList>
</div>